import time
import platform

def getInputTime():
    hour = 0
    minute = 0
    second = 0

    print("请输入要计时的时间(如果不到请填0)")
    hour = int(input("小时数 $ "))
    minute = int(input("分钟数 $ "))
    second = int(input("秒数 $ "))

    result = hour * 60 * 60 + minute * 60 + second
    return result

def timer():
    second = getInputTime()
    if second == 0: return
    while True:
        time.sleep(1.0)
        second -= 1
        print("还剩{}秒".format(second))

        if second == 0:
            print("时间到，计时结束！\n")
            for i in range(0,15):
                if platform.system() == "Windows":
                    __import__("winsound").Beep(900,500)
                else:
                    print("时间到，计时结束！")
            return 
	
if __name__ == "__main__":
    timer()